var Color = {
    None: 0,
    Yellow: 1,
    White: 2,
    Blue: 3,
    Green: 4,
    Orange: 5,
    Red: 6
};

var Dimension = {
    X: 1,
    Y: 2,
    Z: 3,
    X_:4,
    Y_:5,
    Z_:6
};


var PositionVector = function (x, y, z) {
    this.X = x;
    this.Y = y;
    this.Z = z;
}
PositionVector.prototype = {
    Rotate: function (rotateFlag) {
        if (rotateFlag === Dimension.X) {
            {
                var y = -this.Z;
                var z = this.Y;
                this.Y = y;
                this.Z = z;

            }
        } else if (rotateFlag === Dimension.Y) {
            {
                var x = this.Z;
                var z = -this.X;
                this.X = x;
                this.Z = z;

            }
        } else if (rotateFlag === Dimension.Z) {
            {
                var x = -this.Y;
                var y = this.X;
                this.X = x;
                this.Y = y;

            }
        }
    }
};

var ColorVector = function (x, y, z) {
    this.X = x;
    this.Y = y;
    this.Z = z;
}

ColorVector.prototype = {
    Rotate: function (rotateFlag) {
        switch (rotateFlag) {
            case Dimension.X: {
                var temp = this.Y;
                this.Y = this.Z;
                this.Z = temp;
                break;
            }
            case Dimension.Y: {
                var temp = this.Z;
                this.Z = this.X;
                this.X = temp;
                break;
            }
            case Dimension.Z: {
                var temp = this.X;
                this.X = this.Y;
                this.Y = temp;
                break;
            }
        }
    }
}

function Block(lx, ly, lz, cx, cy, cz) {
    this.Position = new PositionVector(lx, ly, lz);
    this.ColorVector = new ColorVector(cx, cy, cz);
}

Block.prototype = {
    Rotate: function (dms, step) {
        for (var i = 0; i < step; i++) {
            this.Position.Rotate(dms);
            this.ColorVector.Rotate(dms);
        }
    }
}